IF EXISTS (SELECT * FROM sysobjects WHERE type = 'V' AND name = 'VW_DomainFetch')
	BEGIN
		DROP  View VW_DomainFetch
	END
GO

CREATE View VW_DomainFetch AS

SELECT
	d.DomainId, d.ServiceId, s.AccountId, d.RegisterDate, d.ExpiryDate,
	a.Title AS AccountTitle, s.Title, s.CreateDate, s.UpdateDate
FROM Domains AS d
INNER JOIN Services AS s ON d.ServiceId = s.ServiceId
INNER JOIN Accounts AS a ON s.AccountId = a.AccountId

GO